<template>
  <div id="app">
    <el-container class="app-container">
      <el-header class="sys-header">Arcgis</el-header>
      <el-container class="app-container-main">
        <el-aside class="sys-aside">
          <el-menu
              router
              @open="handleOpen"
              @close="handleClose"
              :default-active="defaultActive"
              class="el-menu-vertical-demo"
              :collapse="true"
              background-color="#3C467C"
              text-color="#fff"
              active-text-color="#ffd04b">
            <el-menu-item key="/" index="/">
              <i class="el-icon-monitor"></i>
              <span slot="title">首页大屏</span>
            </el-menu-item>
            <el-menu-item key="/oneMap" index="/oneMap">
              <i class="el-icon-picture-outline"></i>
              <span slot="title">一张图</span>
            </el-menu-item>
          </el-menu>
        </el-aside>
        <el-main class="sys-main">
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  computed: {
    // 只匹配第一段路由
    defaultActive() {
      return '/' + this.$route.path.split('/')[1];
    }
  },
  methods:{
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  }
}
</script>

<style>
html,
body,
#app {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
}
.app-container, .app-container-main {
  height: 100%;
}
.sys-header {
  background: #151720;
  line-height: 60px;
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
}
.sys-aside {
  background: #3C467C;
  width: auto!important;
}
.sys-main {
  padding: 5px!important;
}
</style>
